package com.mew.slots.core.game.ald.service;


import com.mew.common.enm.SlotsWinType;
import com.mew.common.entity.game.WinFree;
import com.mew.slots.core.common.game.BaseGameService;
import com.mew.slots.core.common.game.vo.BasePlayMsgs;
import com.mew.slots.core.common.messge.response.SlotsPlayResponseMessage;
import com.mew.slots.core.common.vo.StrategyGameVO;
import com.mew.slots.core.game.ald.message.AldPlayResponseMessage;
import com.mew.slots.core.game.ald.roller.AldXml;
import com.mew.slots.core.game.ald.room.AldPlayMsgs;
import com.mew.slots.core.game.ald.room.AldRoom;

public class AldService extends BaseGameService {
    @Override
    public BasePlayMsgs startGame(StrategyGameVO player) {
        AldRoom room = new AldRoom();
        room.init(player.getRollerId(), AldXml.getInstance(),player.getWinType()== SlotsWinType.Free.code(),player.getInBetNumber(),player.getControlType());
        ((AldPlayMsgs)room.getRes()).betEnough = player.getOtherMsg()[0];
        room.roundPlay();
        return room.getRes();
    }

    @Override
    public SlotsPlayResponseMessage myResp(WinFree winFree, BasePlayMsgs res) {
        AldPlayResponseMessage message = new AldPlayResponseMessage();
        AldPlayMsgs ress = (AldPlayMsgs) res;
        message.setBouns(ress.bouns);
        message.setBounsWin(ress.bounswin);
        message.setUp(ress.up);
        message.setStartSlots(ress.getStartSlots());
        message.setJpStar(ress.getJpStar());

        return message;
    }

    @Override
    public void myAfterResp(SlotsPlayResponseMessage message,StrategyGameVO player, BasePlayMsgs res) {}

    public static void main(String[] args) throws Exception {
        AldXml.getInstance().init();

        AldRoom room = new AldRoom();
        room.init(1,AldXml.getInstance(),false,1000,0);
        ((AldPlayMsgs)room.getRes()).betEnough = 1;
        room.roundPlay();
        System.out.println(room.res);
    }
}
